package com.linewell.dao.impl;

import com.linewell.dao.UserInfoMapper;
import com.linewell.entity.Administrator;
import com.linewell.entity.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class UserInfoDao implements UserInfoMapper {
	
	@Autowired
	private UserInfoMapper userInfoMapper;

	public List<UserInfo> checkNamePwd(String punsterName, String pwd) {
		return userInfoMapper.checkNamePwd(punsterName,pwd);
	}

	public boolean savaUserInfo(UserInfo userInfo) {
		return userInfoMapper.savaUserInfo(userInfo);
	}

	public List<UserInfo> checkPunsterName(String punsterName){
		return userInfoMapper.checkPunsterName(punsterName);
	}

	public boolean uploadUserPicture(String picture, Long userId) {
		return userInfoMapper.uploadUserPicture(picture,userId);
	}


	public List<UserInfo> getHotUser(int page) {
		return userInfoMapper.getHotUser(page);
	}

	public Administrator checkAdmin(String punsterName, String password) {
		return userInfoMapper.checkAdmin(punsterName,password);
	}

	public boolean updataUserInfo(String userId, String nickName, String sex, String birthday, String userEmail, String myself) {
		return userInfoMapper.updataUserInfo(userId,nickName,sex,birthday,userEmail,myself);
	}

	public List<UserInfo> checkPwd(Long userId, String oldPwd) {
		return userInfoMapper.checkPwd(userId,oldPwd);
	}

	public boolean updatePwd(Long userId, String newPwd) {
		return userInfoMapper.updatePwd(userId,newPwd);
	}

	public List<UserInfo> getUsers(int page, int limit) {
		return userInfoMapper.getUsers(page,limit);
	}

	public int getUserCount() {
		return userInfoMapper.getUserCount();
	}

	public List<UserInfo> getUsersByPunsterName(String keyword) {
		return userInfoMapper.getUsersByPunsterName(keyword);
	}

	public boolean deleteAllUser(String userIds) {
		return userInfoMapper.deleteAllUser(userIds);
	}

	public boolean deleteUserByUserId(Long userId) {
		return userInfoMapper.deleteUserByUserId(userId);
	}

	public boolean updateUserState(Long userId, int state) {
		return userInfoMapper.updateUserState(userId,state);
	}

	public boolean updateUser(String field, String value, Long userId) {
		return userInfoMapper.updateUser(field,value,userId);
	}

	public UserInfo getUserById(Long userId) {
		return userInfoMapper.getUserById(userId);
	}

	public UserInfo checkEmail(String punsterName, String email) {
		return userInfoMapper.checkEmail(punsterName,email);
	}

	public UserInfo getUserByUserId(Long userId) {
		return userInfoMapper.getUserByUserId(userId);
	}
}
